import collections


class Treenode:
    def __init__(self, value, state):
        self.value = value
        self.state = state
        self.neighbors = collections.deque()
        self.index = 0
        self.d_child = {}


class FileSystem(object):

    def __init__(self):
        self.root = Treenode('root', -1)

    def createPath(self, path, value):
        """
        :type path: str
        :type value: int
        :rtype: bool
        """
        path = path.split('/')[1:]
        if len(path) == 0:
            return False
        node = self.root
        for i in range(len(path) - 1):
            if path[i] in node.d_child:
                node = node.neighbors[node.d_child[path[i]]]
            else:
                return False
        if path[-1] in node.d_child:
            return False
        else:
            new_node = Treenode(path[-1], value)
            node.d_child[path[-1]] = node.index
            node.index += 1
            node.neighbors.append(new_node)
            return True

    def get(self, path):
        """
        :type path: str
        :rtype: int
        """
        path = path.split('/')[1:]
        node = self.root
        for item in path:
            if item not in node.d_child:
                return -1
            else:
                node = node.neighbors[node.d_child[item]]
        return node.state

